package main.java.design.simplefactory;

/**
 * <p>
 *     简单工厂
 * </p>
 *
 * @author : wangdejian
 * @version 1.0
 * @date : 2020/6/9 21:23
 */
public class TestFactory {

    public static void main(String[] args) {
        Factory factory = new Factory();

        // 方法-1
        Shape circle = factory.getShape("circle");
        circle.draw();
        Shape square = factory.getShape("square");
        square.draw();

        // 反射方法-2
        Shape shapeCircle = factory.getShape(Circle.class);
        shapeCircle.draw();
        Shape shapeSquare = factory.getShape(Square.class);
        shapeSquare.draw();

    }

}
